package main.java.indi.zyj.sword;

public class StatisticalResult {


    public int[] statisticalResult(int[] arrayA) {

        if (arrayA.length == 0) {
            return new int[]{};
        }

        int[] arrayRes = new int[arrayA.length];
        int tmp = 1;
        arrayRes[0] = 1;

        for (int i = 1; i < arrayA.length; i++) {
            arrayRes[i] = arrayRes[i - 1] * arrayA[i - 1];
        }

        for (int i = arrayA.length - 2; i >= 0; i--) {
            tmp *= arrayA[i + 1];
            arrayRes[i] *= tmp;
        }

        return arrayRes;

    }
}
